package com.vitabuybuy.tv.ui.mine.comment.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ActivityMyCommentBinding
import com.vitabuybuy.tv.databinding.ItemMyCommentBinding
import com.vitabuybuy.tv.dto.MyCommentDto
import com.library.common.base.BindRecycAdapter

class MyCommentListAdapter : BindRecycAdapter<ItemMyCommentBinding, MyCommentDto>() {
    override fun onBindViewHolder(
        mBinding: ItemMyCommentBinding,
        itemData: MyCommentDto,
        holder: RecyclerView.ViewHolder,
        position: Int
    ) {
        mBinding.itemData = itemData
        mBinding.ivScore.rating = itemData.scores.toFloat()
        mBinding.ivMore.setOnClickListener {
            onClickMore(position, it)
        }
        mBinding.btnComment.setOnClickListener {
            onComment(position)
        }
    }

    override fun normalViewId(viewType: Int): Int {
        return R.layout.item_my_comment
    }

    lateinit var onClickMore: (position: Int, view: View) -> Unit
    lateinit var onComment: (position: Int) -> Unit

}
